package spring_quartz;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.mail.internet.InternetAddress;

import org.apache.commons.mail.SimpleEmail;

public class SendEmail {
	private static int count=1;
	
	public static void sendMail()throws Exception{
		List<InternetAddress> list=new ArrayList<InternetAddress>();
        list.add(new InternetAddress("522353758@qq.com"));
       
        SimpleEmail email=new SimpleEmail();
        email.setFrom("yangchuan91@163.com");
        email.setCharset("utf-8");
        email.setSentDate(new Date());
        email.setSubject("测试Quartz");
        email.setHostName("smtp.163.com");
        email.setAuthentication("yangchuan91@163.com", "yangchuan922");
        email.setTo(list);
        email.setMsg("Hello,what if you are blind? 不要灰心 不要丧气  不要说什么屌丝不配爱2");
        System.out.println("start to send: NO "+count++);
        email.send();
    }
	
	public static void main(String[] args)  {
		try {
			sendMail();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
